# with ... as 结构
with open("./1.txt", encoding="UTF-8") as f:
    all_date = f.readlines()

    s = 0
    for i in all_date:
        s += float(i)
    a = s/len(all_date)

    print("平均数是:", a)

# with 结构执行完回自动执行 close() 不需要手动执行
# with as 常用于 文件读写的异常处理

